package com.weigang.hello.controller;

import com.weigang.hello.entity.HrUserEntity;
import com.weigang.hello.service.HrUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "用户信息")
@RestController
@RequestMapping("/user")
public class HrUserController {

    @Resource
    private HrUserService hrUserService;

    @ApiOperation(value = "获取用户列表",notes = "获取用户列表")
    @GetMapping(value = "/getUsers")
    public List<HrUserEntity> getUsers(){
        //http://localhost:8080/user/getUsers
        return hrUserService.getUsers();
    }


    @ApiOperation(value = "分页获取用户列表",notes = "分页获取用户列表")
    @GetMapping(value = "/getPageUsers")
    public List<HrUserEntity> getPageUsers(@RequestParam Integer pageNo,@RequestParam Integer pageSize){
        //http://localhost:8080/user/getPageUsers
        return hrUserService.getPageUsers(pageNo,pageSize);
    }
}
